<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

use think\Route;

Route::get('/test123', function () {
    $parents = \app\admin\model\chase\Parents::with('students')->select();
    return json($parents);
});
Route::group('api', function () {
    //首页
    Route::get('indices', 'api/index/index');
    //上传图片
    Route::post('uploads', 'api/index/upload');
    //服务
    Route::get('services/:key', 'api/index/service');


    ###### 动态 ######
    //动态详情
    Route::get('trends/:id', 'api/trend/read');
    //动态列表
    Route::get('trends', 'api/trend/index');
    //轮播图
    Route::get('banners', "api/trend/banner");


    ###### 课程 ######
    //课程
    Route::get('courses', 'api/record/course');
    //食谱
    Route::get('recipes', 'api/record/recipe');
    //学习情况
    Route::get('learnings/students/:student_id', 'api/record/getLearning');
    //添加学习情况
    Route::post('learnings/students/:student_id', 'api/record/createLearning');
    //编辑学习情况
    Route::put('learnings/:learning_id/students', 'api/record/updateLearning');
    //在园情况
    Route::get('gardens/students/:student_id', 'api/record/getGarden');
    //添加在园情况
    Route::post('gardens/students/:student_id', 'api/record/createGarden');
    //编辑在园情况
    Route::put('gardens/:garden_id/students', 'api/record/updateGarden');
    //月报
    Route::get('monthreports/students/:student_id', 'api/record/getMonthReport');
    //学期报
    Route::get('termreports/students/:student_id', 'api/record/getTermReport');


    ###### 教师 #######
    //教师登录
    Route::post('teachers/login', 'api/teacher/login');
    //学生列表
    Route::get('teachers/:teacher_id/students', 'api/teacher/student');
    //学生亲友团
    Route::get('students/:student_id/friends', 'api/teacher/studentFriend');
    //学生详情
    Route::get('students/:student_id/detail', 'api/teacher/studentDetail');
    //上传学生图片
    Route::post('students/:student_id/photos', 'api/teacher/addStudentPhoto');
    //删除图片
    Route::delete('photos/:photo_id', 'api/teacher/delPhoto');
    //签到详情
    Route::post('qrcode/detail', 'api/teacher/qrcode');
    //签到
    Route::post('qrcode/check', 'api/parents/shuttle');
    //学生姓名
    Route::get('students/:parent_id/name', 'api/teacher/name');
    //学生请假
    Route::post('students/:parent_id/leave', 'api/teacher/leave');
    //老师审批列表
    Route::get('teachers/:teacher_id/approve', 'api/teacher/teacherApprove');
    //老师审批
    Route::post('leaves/:leave_id', 'api/teacher/checkLeave');


    ###### 家长 ######
    //家长请假列表
    Route::get('parents/:parent_id/approve', 'api/parents/parentApprove');
    //接送二维码
    Route::get('qrcode', 'api/parents/qrcode');
    //考勤记录
    Route::get('records', 'api/parents/record');


    ####### 亲友 #######
    //亲属关系
    Route::get("relations", "api/friend/relation");
    //亲友团列表
    Route::get('parents/:parent_id/friends', 'api/friend/index');
    //添加亲友
    Route::post('parents/:parent_id/friends', 'api/friend/create');
    //亲友
    Route::get('friends/:friend_id', 'api/friend/read');
    //修改亲友
    Route::post('friends/:friend_id', 'api/friend/update');
    //删除亲友
    Route::delete('friends/:friend_id', 'api/friend/delete');
    //亲友审核
    Route::post('friends/:friend_id/check', 'api/friend/check');


    ###### 设置 ######
    //校长信息
    Route::get("rector", "api/setting/rector");
    //信箱留言
    Route::post("rector", "api/setting/message");
    //通知
    Route::get("notification", "api/setting/notification");
    //法定节假日
    Route::get('holidays', 'api/setting/holiday');


    ###### 我的 ######
    //解密数据
    Route::post('decrypt', 'api/user/decryptData');
    //我的相册
    Route::get('students/:student_id/photos', 'api/user/photos');
    //授权
    Route::post('auth', 'api/user/auth');
    //发送短信
    Route::post("sms/send", "api/user/send");
    //绑定手机号
    Route::post("users/phone", "api/user/bind");
    //更新用户头像昵称
    Route::post('users', 'api/user/update');
    //用户信息
    Route::get('users', 'api/user/info');


});